<template>
  <div class="help-assign-table">
      <el-table v-loading="loading" :data="helpAssignList">
        <el-table-column
          label="序号"
          align="center"
          width="60"
          type="index"
          :index="idx()"

        />

        <el-table-column
          label="企业名称"
          align="left"
          prop="companyName"
          min-width="10%"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="社会信用代码"
          align="left"
          prop="creditCode"
          min-width="18%"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="企业分类"
          align="center"
          prop="companyType.desc"
          min-width="10%"
        />
        <el-table-column
          label="求助类型"
          align="center"
          prop="helpType.desc"
          min-width="10%"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="提交时间"
          align="center"
          prop="helpTime"
          min-width="10%"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="状态"
          align="center"
          prop="status.value"
          min-width="10%"
          :show-overflow-tooltip="true"
          :formatter="In_shift_process"
        />
        <el-table-column
          label="操作"
          align="center"
          min-width="15%"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click="handleDetail(scope.row.id)"
            >
              详情
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleAllocation(scope.row.id)"
              :disabled="estimate(scope)"
            >
              回复
            </el-button>

          </template>
        </el-table-column>
      </el-table>
  </div>
</template>

<script>

  export default {
    name: 'HelpAssignTable',
    props:{
      helpAssignList:Array,
      currPage:Number,
      pageSize:Number
      },
    data(){
      return {

      }
    },
    created(){
        this.estimate();
        console.log(scope)
    },
    methods:{

      // 序号数据处理
      idx(){
        return (this.currPage - 1) * this.pageSize + 1
      },

      //  点击分配部门事件
      handleAllocation(scope){
          this.$emit("handleAllocation",scope)
      },

      // 点击数据详情页
      handleDetail(scope){
          this.$emit("handleDetail",scope)
      },

      // 判断是否可以分配
      estimate(scope){
          return (scope.row.status.value == 4 ) ? false : true
      },

      // 状态判断
      In_shift_process(row){
        return (row.status.value == 4)? "待回复" : "已回复"
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>
